package levy.sum.chapter1.server;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class ServerMessageHandler extends SimpleChannelInboundHandler<String> {

	@Override
	protected void channelRead0(ChannelHandlerContext ctx, String msg)
			throws Exception {
		System.out.println("receive from client:" + msg);
		if ("quit".equalsIgnoreCase(msg))
			ctx.close();
		ctx.writeAndFlush(msg + "#_#");
	}

}
